<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('注销原因')"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-ShopOffUser-edit">
        <input name="shopId" id="shopId" th:value="${shopId}" hidden>
        <div class="form-group">
            <label class="col-sm-3 control-label">注销原因：</label>
            <div class="col-sm-8">
                <textarea name="handResult" id="handResult" class="form-control" rows="5" required></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">上传凭证：</label>
            <div class="col-sm-8">
                <input id="manyFiles" class="file" type="file" multiple
                       data-allowed-file-extensions='["png", "jpeg", "gif", "jpg"]' data-max-file-count="5">
            </div>
        </div>
    </form>
</div>
<!--图片预览-->
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: select2-js"/>
<script type="text/javascript">
    function submitHandler() {
        $.modal.confirm("是否确认注销该商铺", function () {
            var handResult = $("#handResult").val().trim()
            var shopId = $("#shopId").val()
            if (!handResult) {
                $.modal.alertWarning("原因必须填写");
                return false
            }
            var formData = new FormData($("#form-ShopOffUser-edit")[0]);
            if ($('#manyFiles')[0].files.length > 0) {
                for (var i = 0; i < $('#manyFiles')[0].files.length; i++) {
                    formData.append('manyFiles', $('#manyFiles')[0].files[i]);
                }
            } else {
                $.modal.alertWarning("缺少文件")
                return false;
            }
            $.ajax({
                url: ctx + "WxShop/WxShop/offShop",
                type: 'post',
                cache: false,
                data: formData,
                processData: false,
                contentType: false,
                dataType: "json",
                success: function (result) {
                    $.operate.successCallback(result);
                }
            });

        })
    }

</script>
</body>
</html>